import  { useGet, usePost } from '@/utils/request'

/**
 * 获取题解列表
 * @param params 分页参数
 * @returns 题解列表
 */
export const getSolutionListPageVoApi = (params: API.Problem.SolutionQueryRequest) => {
  return usePost<API.Problem.SolutionVoPage, API.Problem.SolutionQueryRequest>('/problem/solution/list/page/vo', params)
}

/**
 * 发布题解
 * @param params 题解信息
 * @returns 题解
 */
export const publishSolutionApi = (params: API.Problem.SolutionAddRequest) => {
  return usePost<API.Problem.SolutionVo, API.Problem.SolutionAddRequest>('/problem/solution/publish', params)
}

/**
 * 获取最近发布的题解列表
 */
export const getRecentlyPublishedSolutionListApi = () => {
  return useGet<API.Problem.RecentlySolutionVo[]>('/problem/solution/get/recently/list')
}

/**
 * 获取题解详情
 * @param params 题解id
 * @returns 题解详情
 */
export const getSolutionDetailApi = (solutionId: string) => {
  return useGet<API.Problem.SolutionVo, API.Problem.SolutionQueryRequest>('/problem/solution/get/detail/' + solutionId)
}



